{% extends 'admin/base_admin.html' %}
{% block content %}
<form action="/admin/banners/new" method="post" enctype="multipart/form-data" class="bg-white border rounded-xl p-4 flex items-end gap-4">
    <div><label class="text-sm">标题</label><input name="title" class="mt-1 border rounded p-2 text-sm"/></div>
    <div><label class="text-sm">链接</label><input name="link_url" class="mt-1 border rounded p-2 text-sm"/></div>
    <div><label class="text-sm">排序</label><input name="sort_order" type="number" class="mt-1 border rounded p-2 text-sm w-24"/></div>
    <div><label class="text-sm">图片</label><input type="file" name="image" class="mt-1 text-sm"/></div>
    <button class="bg-emerald-600 text-white px-4 py-2 rounded">新增</button>
</form>


<table class="mt-4 w-full text-sm">
    <thead><tr class="text-left border-b"><th>图片</th><th>标题</th><th>链接</th><th>排序</th></tr></thead>
    <tbody>
        {% for i in items %}
        <tr class="border-b">
            <td><img src="{{ i.image_path }}" class="w-28 h-16 object-cover rounded"/></td>
            <td>{{ i.title }}</td>
            <td class="truncate max-w-xs">{{ i.link_url }}</td>
            <td>{{ i.sort_order }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}